#ifndef __BOX_HPP__
#define __BOX_HPP__

#include <cstdint>
#include "Point3.hpp"

namespace PocketSurvival::Engine
{
    struct Box
    {
        int32_t Left;
        int32_t Top;
        int32_t Near;
        int32_t Width;
        int32_t Height;
        int32_t Depth;

        constexpr Box() noexcept;
        constexpr Box(int32_t left, int32_t top, int32_t near, int32_t width, int32_t height, int32_t depth) noexcept;

        inline void setLocation(const Point3 &point);
        inline Point3 getLocation();
        inline void setSize(const Point3 &point);
        inline Point3 getSize();

        inline int32_t getRight();
        inline int32_t getBottom();
        inline int32_t getFar();

        friend constexpr inline bool operator==(const Box &left, const Box &right)
        {
            return  (left.Left == right.Left) && (left.Top == right.Top) && (left.Near == right.Near) && 
                    (left.Width == right.Width) && (left.Height == right.Height) && (left.Depth == right.Depth);
        }
        friend constexpr inline bool operator!=(const Box &left, const Box &right)
        {
            return !(left == right);
        }
    };

    constexpr inline Box::Box() noexcept : Left(0), Top(0), Near(0), Width(0), Height(0), Depth(0) {}
    constexpr inline Box::Box(int32_t left, int32_t top, int32_t near, int32_t width, int32_t height, int32_t depth) noexcept : 
        Left(left),
        Top(top),
        Near(near),
        Width(width),
        Height(height),
        Depth(depth) {}

    inline void Box::setLocation(const Point3 &point)
    {
        Left = point.posX;
        Top = point.posY;
        Near = point.posZ;
    }
    inline Point3 Box::getLocation()
    {
        return Point3 { Left, Top, Near };
    }
    inline void Box::setSize(const Point3 &point)
    {
        Width = point.posX;
        Height = point.posY;
        Depth = point.posZ;
    }
    inline Point3 Box::getSize()
    {
        return Point3 { Width, Height, Depth };
    }

    inline int32_t Box::getRight()
    {
        return Left + Width;
    }
    inline int32_t Box::getBottom()
    {
        return Top + Height;
    }
    inline int32_t Box::getFar()
    {
        return Near + Depth;
    }


} // namespace PocketSurvival::Engine

#endif